from marajo.appengine.ext import db
from marajo.appengine.api.users import User
from resources.ticket import Ticket

class Comment(db.Model):
    """
    A comment left on a ticket
    """
    comment = db.StringProperty(verbose_name="Comment")
    date = db.DateTimeProperty(auto_now_add=True, verbose_name="Date")
    owner = db.ReferenceProperty(User, collection_name="comments", verbose_name="Owner")
    changes = db.ListProperty(str, verbose_name="Changes")
    ticket = db.ReferenceProperty(Ticket, collection_name="comments")
    hours = db.IntegerProperty(default=0, verbose_name="Hours Worked")
    minutes = db.IntegerProperty(default=0, verbose_name="Minutes Worked")

    def __str__(self):
        return self.comment
